package com.zy.store.config;


import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * description Knife4j配置类
 *
 * @author ZY
 * @date 2021年04月10日 22:40
 **/
@Configuration
@EnableKnife4j
public class Knife4jConfig {

    @Bean(value = "api")
    public Docket api() {
        return buildDocket();
    }

    private Docket buildDocket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("swagger")
                        .contact(new Contact("ZY", "http://www.baidu.com", "zyexplorej2ee@sina.com"))
                        .description("Restful APIs")
                        .version("1.0")
                        .build())
                .groupName("外部调用接口")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.zy.store.controller"))
                .paths(PathSelectors.any())
                .build();
    }
}